package cn.iocoder.yudao.module.form.service.impl;

import cn.iocoder.yudao.module.form.dataobject.CugbEquipment;
import cn.iocoder.yudao.module.form.mysql.CugbEquipmentMapper;
import cn.iocoder.yudao.module.form.service.ICugbEquipmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 设备采购Service业务层处理
 *
 * @author cugb
 * @date 2022-08-26
 */
@Service
public class CugbEquipmentServiceImpl implements ICugbEquipmentService
{
    @Autowired
    private CugbEquipmentMapper cugbEquipmentMapper;

    /**
     * 查询设备采购
     *
     * @param equId 设备采购主键
     * @return 设备采购
     */
    @Override
    public CugbEquipment selectCugbEquipmentByEquId(Long equId)
    {
        return cugbEquipmentMapper.selectCugbEquipmentByEquId(equId);
    }

    /**
     * 查询设备采购列表
     *
     * @param cugbEquipment 设备采购
     * @return 设备采购
     */
    @Override
    public List<CugbEquipment> selectCugbEquipmentList(CugbEquipment cugbEquipment)
    {
        return cugbEquipmentMapper.selectCugbEquipmentList(cugbEquipment);
    }

    /**
     * 新增设备采购
     *
     * @param cugbEquipment 设备采购
     * @return 结果
     */
    @Override
    public int insertCugbEquipment(CugbEquipment cugbEquipment)
    {
        Date date = new Date();
        cugbEquipment.setCreateTime(date);
        cugbEquipment.setEquType(cugbEquipment.getType().toString());
        return cugbEquipmentMapper.insertCugbEquipment(cugbEquipment);
    }

    /**
     * 修改设备采购
     *
     * @param cugbEquipment 设备采购
     * @return 结果
     */
    @Override
    public int updateCugbEquipment(CugbEquipment cugbEquipment)
    {
//        cugbEquipment.setUpdateTime(DateUtils.getNowDate());
        return cugbEquipmentMapper.updateCugbEquipment(cugbEquipment);
    }

    /**
     * 批量删除设备采购
     *
     * @param equIds 需要删除的设备采购主键
     * @return 结果
     */
    @Override
    public int deleteCugbEquipmentByEquIds(Long[] equIds)
    {
        return cugbEquipmentMapper.deleteCugbEquipmentByEquIds(equIds);
    }

    /**
     * 删除设备采购信息
     *
     * @param equId 设备采购主键
     * @return 结果
     */
    @Override
    public int deleteCugbEquipmentByEquId(Long equId)
    {
        return cugbEquipmentMapper.deleteCugbEquipmentByEquId(equId);
    }
}
